import java.util.Arrays;

/**
 * Created with IntelliJ IDEA
 * Description
 * User:user
 * Date:2021-10-17
 * Time:19:35
 */
public class TestDemo {


    //交换两个数组的内容
    public static  void verse(int[] arry1,int[] arry2){
        for (int i = 0; i < arry1.length; i++) {
            int tmp = arry1[i];
            arry1[i] = arry2[i];
            arry2[i] = tmp;
        }
    }

    public static void main(String[] args) {
        int[] arry1= {1,2,3};
        int[] arry2 = {4,5,6};
        verse(arry1,arry2);
        System.out.println(Arrays.toString(arry1));
        System.out.println(Arrays.toString(arry2));

    }





   /* public static void init(int[] arry){
        for (int i = 0; i < arry.length; i++) {
            arry[i] = 0;
        }
    }
    public static void print(int[] arry){
        for (int i = 0; i < arry.length; i++) {
            System.out.print(arry[i] + " ");
        }
    }
    public  static void reverse(int[] arry){
        int left = 0;
        int right = arry.length - 1;
        while(left<right){
            int tmp = arry[left];
            arry[left] = arry[right];
            arry[right] = tmp;
            left++;
            right--;
        }
    }

    public static void main(String[] args) {
        int[] arry = {1,2,3,4,5,6,7,8,9};
        reverse(arry);
        print(arry);
        System.out.println(" ");
        print(arry);
        System.out.println(" ");
        init(arry);
        print(arry);
        reverse(arry);
    }*/

    //冒泡排序
  /*  public static void bubble_sort(int[] arry){
        for (int i = 0; i < arry.length - 1; i++) {
            int flag = 1;
            for (int j = 0; j < arry.length - 1 - i ; j++) {
                if(arry[j]>arry[j+1]){
                    int tmp = arry[j];
                    arry[j] = arry[j+1];
                    arry[j+1] = tmp;
                    flag = 0;
                }
            }
            if(flag == 1){
                break;
            }
        }
    }
    public static void main(String[] args) {
        int[] arry = {4,9,8,65,12,34};
        bubble_sort(arry);
        System.out.println(Arrays.toString(arry));
    }
*/
}

